package thread;

/**
 * 实现Runnable接口
 */

class MyRunnable implements Runnable {
    @Override
    public void run() {
        System.out.println("hello world");
    }
}
// 使用
public class ThreadDemo2 {
    public static void main(String[] args) {
        MyRunnable runnable = new MyRunnable();
        Thread thread = new Thread(runnable);
        thread.start(); // 启动线程
    }
}
